-- 参数获取
-- /lua3?aa=1&name=111&age=111&age=111222

local uri_args = ngx.req.get_uri_args()
for k,v in pairs(uri_args) do
    if type(v) == "table" then
        ngx.say(k," : ",table.concat(v," , "),"<br/>")
    else
        ngx.say(k," : ",v,"<br/>")
    end
end

ngx.say(" ========== headers ========== <br/>")

-- headers
local headers = ngx.req.get_headers()
ngx.say("host: ",headers["Host"],"<br/>")
ngx.say("user-agent: ",headers["user-agent"],"<br/>")
ngx.say("user-agent: ",headers.user_agent,"<br/>")
for k,v in pairs(headers) do
    if type(v) == "table" then
        ngx.say(k," : ",table.concat(v," , "),"<br/>")
    else
        ngx.say(k," : ",v,"<br/>")
    end
end